<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="Dashboard">
    <meta name="keyword" content="Dashboard, Bootstrap, Admin, Template, Theme, Responsive, Fluid, Retina">
    <link rel="shortcut icon" href="__PUBLIC__/img/logo.png">
    <title>{$nn}后台登陆系统</title>

    <!-- Bootstrap core CSS -->
    <link href="__PUBLIC__/ds/assets/css/bootstrap.css" rel="stylesheet">
    <!--external css-->
    <link href="__PUBLIC__/ds/assets/font-awesome/css/font-awesome.css" rel="stylesheet" />

    <!-- Custom styles for this template -->
    <link href="__PUBLIC__/ds/assets/css/style.css" rel="stylesheet">
    <link href="__PUBLIC__/ds/assets/css/style-responsive.css" rel="stylesheet">

    <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
    <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>

<body>

<!-- **********************************************************************************************************************************************************
MAIN CONTENT
*********************************************************************************************************************************************************** -->

<div id="login-page">
    <div class="container">

        <form class="form-login" action="{:U('login')}" method="post">
            <h2 class="form-login-heading">{$nn}后台登陆</h2>
            <div class="login-wrap">
               <!-- <select name="type" id="type" class="form-control" style="margin-bottom:15px;">
                    <option value="1">请选择管理员类型</option>
                    <option value="2">公司</option>
                    <option value="3">商家</option>
                </select>-->
                <input id="numbers" type="text" name="numbers" class="form-control" placeholder="账号" autofocus>
                <br>
                <input id="password"  type="password" name="password" class="form-control" placeholder="密码">
                <br>
                <div style="position: relative">
                    <input style="width: 50%;" type="text" id="token" name="token" class="form-control" placeholder="验证码">
                    <img  style="position: absolute;right: 0;top: 0;cursor: pointer" src="{:U('captcha')}" class="dian">
                </div>
                <br>
                <!--<label class="checkbox">
		                <span class="pull-right">
		                    &lt;!&ndash;<a data-toggle="modal" href="Login.html#myModal"> 忘记密码?</a>&ndash;&gt;
		
		                </span>
                </label>-->
                <input id="btn" class="btn btn-theme btn-block fa fa-lock" type="button" value="登录">
            </div>
        </form>

    </div>
</div>

<!-- js placed at the end of the document so the pages load faster -->
<script src="__PUBLIC__/ds/assets/js/jquery.js"></script>
<script src="__PUBLIC__/ds/assets/js/bootstrap.min.js"></script>

<!--BACKSTRETCH-->
<!-- You can use an image of whatever size. This script will stretch to fit in any screen size.-->
<script type="text/javascript" src="__PUBLIC__/ds/assets/js/jquery.backstretch.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/ui/lib/layer/2.4/layer.js"></script>
<script>
    $.backstretch("__PUBLIC__/ds/assets/img/login-bg.png", {speed: 500});
    //二维码点击刷新
    $('.dian').click(function (){
        fresh();
    })
    function fresh() {
        $('.dian').attr('src',$('.dian').attr('src'));
    }
    //登录
    $("#btn").on("click",function(){
        var numbers  = $("#numbers").val()
        var password = $("#password").val()
        var token    = $("#token").val()
        //var type    = $("#type").val()
        if(numbers == "" || password == ""){
            layer.open({
                title: '登录提示：',content: '请填写必要登录信息'
            });
        }else{
            $.ajax({
                type:"post",
                data:{numbers:numbers,password:password,token:token},
                url:"{:U('Login/login')}",
                success:function(data){
                    if(data.status == 1){
                        layer.open({
                            title: '登录提示：',content: '验证码输入有误'
                        });
                    }else if(data.status == 3){
                        layer.open({
                            title: '登录提示：',content: '账号密码有误'
                        });
                    }else if(data.status == 4){
                        layer.open({
                            title: '登录提示：',content: '您的账号已被禁用，不能登录！'
                        });
                    }else{
                        window.location.href="{:U('Index/index')}";
                    }
                }
            })
        }
    })
</script>


</body>
</html>
